package performance;

import java.util.ArrayList;
import java.util.Random;

public class PerformanceTester {
	public static void main(String args[])
	{
		ArrayList<Double> a = new ArrayList<Double>();
		ArrayList<Double> b;
		Random random = new Random();
		for (int i=0; i<100000; i++)
		{
			a.add(random.nextDouble());
		}
		b = (ArrayList<Double>) a.clone();
		
		long start = System.currentTimeMillis();
		QuickSort_Rec.qsort(a, 0, a.size()-1);
		long end = System.currentTimeMillis();
		System.out.println("rec use time: " + (end - start));
		
		a = (ArrayList<Double>) b.clone();
		start = System.currentTimeMillis();
		QuickSort_NoRec.qsort(a, 0, a.size()-1);
		end = System.currentTimeMillis();
		System.out.println("no_rec use time: " + (end - start));
		
		a = (ArrayList<Double>) b.clone();
		start = System.currentTimeMillis();
		QuickSort_NoRec_Insert.qsort(a, 0, a.size()-1);
		end = System.currentTimeMillis();
		System.out.println("no_rec_insert use time: " + (end - start));
		
		a = (ArrayList<Double>) b.clone();
		start = System.currentTimeMillis();
		QuickSort_NoRec_Random.qsort(a, 0, a.size()-1);
		end = System.currentTimeMillis();
		System.out.println("no_rec_random use time: " + (end - start));
		
		a = (ArrayList<Double>) b.clone();
		start = System.currentTimeMillis();
		QuickSort_NoRec_AllImproved.qsort(a, 0, a.size()-1);
		end = System.currentTimeMillis();
		System.out.println("no_rec_all_improved use time: " + (end - start));
		
	}

}
